package com.mdxq.mall.listener;

import com.mdxq.mall.entity.Person;
import com.mdxq.mall.mapper.PersonMapper;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import reactor.util.concurrent.Queues;

@Component
@RabbitListener(queues = "upbm_queue")
public class UpdatePersonBalanceListener {
    @Autowired
    private PersonMapper personMapper;
    @RabbitHandler
    private void handle(Person person){
        personMapper.updateBalance(person.getAccountBalance(),person.getId(),person.getVersion());
    }
}
